Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bufferutil

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bufferutil

WebSocket buffer utils

  • 4.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2M
increased by4.68%
Maintainers
3
Weekly downloads
 
Created

What is bufferutil?

The bufferutil package is a Node.js utility module that provides efficient buffer operations. It is primarily used to enhance the performance of binary data manipulation by providing a native addon for buffer operations which are faster than pure JavaScript implementations.

What are bufferutil's main functionalities?

Masking and unmasking WebSocket frames

This feature allows you to mask and unmask data according to the WebSocket protocol, which is useful for WebSocket frame manipulation.

const bufferUtil = require('bufferutil');
const buffer = Buffer.from('Hello World');
const masked = bufferUtil.mask(buffer, Buffer.from([0x12, 0x34, 0x56, 0x78]));
const unmasked = bufferUtil.unmask(masked, Buffer.from([0x12, 0x34, 0x56, 0x78]));

Buffer concatenation

This feature provides a method to concatenate multiple buffers into a single buffer efficiently.

const bufferUtil = require('bufferutil');
const buffers = [Buffer.from('Hello'), Buffer.from(' '), Buffer.from('World')];
const concatenated = bufferUtil.concat(buffers);

Buffer comparison

This feature allows you to compare two buffers for equality, which is faster than comparing them byte-by-byte in JavaScript.

const bufferUtil = require('bufferutil');
const buffer1 = Buffer.from('Hello');
const buffer2 = Buffer.from('Hello');
const isEqual = bufferUtil.equals(buffer1, buffer2);

Other packages similar to bufferutil

Keywords

FAQs

Package last updated on 15 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc